import { base_url } from "../../config/config.js"
const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    ptjob:[]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let keyword = options.keyword;
    let that = this;
    wx.request({
      url: base_url + "/job/keyword?keyWord=" + keyword,
      method: "GET",
      success(res) {
        console.log(res)
        if (res.statusCode == 200){
          that.setData({
            "ptjob": res.data.jobs
          })
        } else {
          wx.showToast({
            title: '获取数据失败！',
            icon: "none"
          })
        }
      },
      fail(res) {
        wx.showToast({
          title: '获取数据失败！',
          icon: "none"
        })
      }
    })
  },
  goto_job_detail(e) {
    let job_id = e.currentTarget.dataset.jobid
    let merchantid = e.currentTarget.dataset.merchantid
    wx.navigateTo({
      url: '../job_detail/job_detail?job_id=' + job_id + "&merchantid=" + merchantid,
    })
  }
})